﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.Practices.Unity;

using Happy.ExtentionMethods;
using Happy.Bootstrap.Unity.Internal;

namespace Happy.Bootstrap.Unity
{
    /// <summary>
    /// 扩展<see cref="RegisterServiceByConventionPlugin"/>。
    /// </summary>
    public static class RegisterServiceByConventionPlugExtentions
    {
        /// <summary>
        /// 按照约定自动注册同步事件订阅者、异步事件订阅者和离线事件订阅者。
        /// </summary>
        public static RegisterServiceByConventionPlugin UseEventSubscriberRegister(this RegisterServiceByConventionPlugin that)
        {
            that.MustNotNull("that");

            return that.AddConvertion(new EventSubscriberRegister());
        }

        /// <summary>
        /// 按照约定自动注册工作单元。
        /// </summary>
        public static RegisterServiceByConventionPlugin UseUnitOfWorkRegister(this RegisterServiceByConventionPlugin that)
        {
            that.MustNotNull("that");

            return that.AddConvertion(new UnitOfWorkRegister());
        }
    }
}
